package com.bocloud.cmp.dao.app.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import com.bocloud.cmp.dao.app.RegistrySoftwareDao;
import com.bocloud.cmp.entity.app.resource.RegistrySoftware;
import com.bocloud.common.utils.MapTools;
import com.bocloud.database.core.BasicDao;
/**
 * 仓库镜像Dao层实现类
 * @author Zaney
 * @data:2017年3月15日
 * @describe:
 */
@Repository
public class RegistrySoftwareDaoImpl extends BasicDao implements RegistrySoftwareDao{

	@Override
	public boolean saveRegistrySoftware(RegistrySoftware registrySoftware) throws Exception {
		return this.baseSaveEntity(registrySoftware);
	}

	@Override
	public boolean deleteRegistrySoftware(RegistrySoftware registrySoftware) throws Exception {
		return this.baseDelete(registrySoftware);
	}

	@Override
	public List<RegistrySoftware> getRegistrySoftwareById(Long id) throws Exception {
		String sql = "select * from repository_software_info where  id = :id";
		Map<String, Object> paramMap = MapTools.simpleMap("id", id);
		List<Object> list = this.queryForList(sql, paramMap, RegistrySoftware.class);
		List<RegistrySoftware> result = new ArrayList<>();
		for (Object object : list) {
			result.add((RegistrySoftware) object);
		}
		return result;
	}
	
}
